const express = require('express')
const db = require('../database/index')

exports.loadPicture = (req,res)=>{

    console.log('请求:加载图片')

    const sql = `select * from picture where PostID = ?`;

    db.query(sql, [req.params.id], (err, results) => {

        // sql执行失败
        if (err) return res.send({ status: 1, message: 'sql执行失败' });

        // 无相关图片
        if(results.length === 0) return res.send({ status: 1, message: '无图片' });

        // 查询成功
        res.send({ status: 0, message: '加载图片成功', data: results });

    });

}


exports.uploadPicture = (req,res) => {
    console.log('请求:上传图片')
}